<div class="row">
	<div class="col-md-12">
		<ol class="breadcrumb">
			<li>
				<a href="#" onclick="toHome()">
					主页
				</a>
			</li>
			<li>
				<a href="#" class="toList" onclick="toExchangeList()">
					优惠券列表
				</a>
			</li>
			<li class="active">
				添加优惠券
			</li>
		</ol>
	</div>
</div>
<div class="row page-cont">
	<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cont-top">
		<div class="panel panel-white">
			<div class="panel-heading">
				<h4 class="panel-title">
					<span class="title-text">优惠券录入</span>
				</h4>
				<div class="panel-tools">
					<div class="dropdown">
						<a data-toggle="dropdown" class="btn btn-xs dropdown-toggle btn-transparent-grey">
							<i class="fa fa-cog"></i>
						</a>
						<ul class="dropdown-menu dropdown-light pull-right" role="menu">
							<li>
								<a class="panel-collapse collapses" href="#"><i class="fa fa-angle-up"></i> <span>折叠</span> </a>
							</li>
							<li>
								<a class="panel-expand" href="#">
									<i class="fa fa-expand"></i> <span>全屏</span>
								</a>
							</li>
						</ul>
					</div>
					<a class="btn btn-xs btn-link panel-close" href="#">
						<i class="fa fa-times"></i>
					</a>
				</div>
			</div>
			<div class="panel-body">
				<form id="editForm" action="https://zxgp.tihe-china.com/tihe/discount/addtest" method="POST" role="form" class="form-horizontal">
					<div class="form-group">
						<label class="col-sm-2 control-label">生成卡数量</label>
						<div class="col-sm-5">
							<input class="form-control" type="text" id="number" name="genCardNum" onkeyup="value=value.replace(/[^\d]/g,'');" > 
						</div>
						<span class="help-inline col-sm-4 minimum_price_help"> <i class="fa fa-info-circle"></i> 请输入数字。注：1分钟内只能生成1000张 </span>
					</div>
					<div class="form-group" style="display: none">
						<div class="col-sm-5">
							<input class="form-control" type="text" id="username" name="username" /> 
						</div>
						<div class="col-sm-5">
							<input class="form-control" type="text" id="token" name="token" /> 
						</div>						
					</div>					
					<div id="wheelAwardItem" class="wheelAwardItem">
						<hr style="height:1px;border:none;border-top:1px solid #555555;" />
						<div class="form-group">
							<div class="col-sm-2 col-sm-offset-3">
								<button type="button" class="btn btn-green" onclick="removeItem(this)">删除</button>
							</div>
						</div>


						<div class="form-group">
							<label class="col-sm-2 control-label">优惠券名称</label>
							<div class="col-sm-5">
								<input class="form-control name" type="text" name="couponList[0].name" id="name"  > 
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-sm-2 control-label">优惠券适用场景</label>
							<div class="col-sm-5">
								<select  name="couponList[0].prefix" class="combox prefix" id="prefix" onchange="change(this);" >
									<option value="REDBAG_">红包</option>
									<option value="EXCHANGE_">通兑券</option>
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">优惠券数量</label>
							<div class="col-sm-5">
								<input class="form-control point" type="text" name="couponList[0].point" id="point" onkeyup="value=value.replace(/[^\d]/g,'');" onchange="limit_coupon_num(this);" > 
							</div>
							<span class="help-inline col-sm-4"> <i class="fa fa-info-circle"></i> 请输入数字</span>
						</div>
						
						<div class="form-group">
							<label class="col-sm-2 control-label">介绍</label>
							<div class="col-sm-5">
								<input class="form-control introduction" type="text"
									  name="couponList[0].introduction" id="introduction"  >
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-sm-2 control-label">开始日期</label>
							<div class="col-sm-5">
					  			<input class="form-control Wdate begin_date" type="text" name="couponList[0].begin_date" id="begin_date" readonly 
					  			> 
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-sm-2 control-label">结束日期</label>
							<div class="col-sm-5">
						  		<input class="form-control Wdate end_date" type="text" name="couponList[0].end_date" id="end_date" readonly
						  		 > 
							</div>
						</div>
	
						<div class="form-group">
							<label class="col-sm-2 control-label">最大价格</label>
							<div class="col-sm-5">
								<input class="form-control maximum_price" type="text"
					  			  name="couponList[0].maximum_price" id="maximum_price" onkeyup="clearNoNum(this)" > 
							</div>
							<span class="help-inline col-sm-4 maximum_price_help"> <i class="fa fa-info-circle"></i> 红包金额，也是红包能够减免的最大金额</span>
						</div>
						
						<div class="form-group minimum_price_div">
							<label class="col-sm-2 control-label">最小价格</label>
							<div class="col-sm-5">
								<input class="form-control minimum_price" type="text"
					  			  name="couponList[0].minimum_price" id="minimum_price" onkeyup="clearNoNum(this)" > 
							</div>
							<span class="help-inline col-sm-4 minimum_price_help" id="min_price" > <i class="fa fa-info-circle"></i> 支付金额要大于此输入数值才能够使用，可不填</span>
						</div>
						
						
						<!-- 限制影片 -->
						<div class="form-group">
							<label class="col-sm-2 control-label">是否限制影片使用</label>
							<div class="col-sm-5">
								<input type="checkbox"  class="is_range_film" value="确定" onclick="lookfilm(this);" />
							</div>
						</div>
						
						<div class="form-group type_dis_film" style="display : none" >
							<label class="col-sm-2 control-label">请填写待搜索影片名</label>
							<div class="col-sm-5">
								<input class="form-control range_film_name" type="text"  autocomplete="off"  /> 
								<input class="form-control range_film_id" name="couponList[0].rangeFilmId" type="hidden"/> 
								<ul class="tip">

								</ul>
							</div>
						</div>
						<div class="form-group type_dis_film" id="type_dis_formal" style="display : none" >
							<label class="col-sm-2 control-label">确定影片名</label>
							<div class="col-sm-5">
								<textarea class="form-control range_film_name_formal" rows="4" cols="12" name="couponList[0].rangeFilmName"  id="getfilmname_formal" readonly></textarea>
							</div>
							<span class="help-inline col-sm-4" id="min_price" > <i class="fa fa-info-circle"></i> 提交影片以此栏内容为准</span>
						</div>
						
						<!-- 限制影院 -->
						<!-- <div class="form-group">
							<label class="col-sm-2 control-label">是否限制影院使用</label>
							<div class="col-sm-5">
								<input type="checkbox"  class="is_range_cinema" value="确定" onclick="lookcinema(this);" />
							</div>
						</div>
						
						<div class="form-group type_dis_cinema" style="display : none" >
							<label class="col-sm-2 control-label">请填写待搜索影院名</label>
							<div class="col-sm-5">
								<input class="form-control range_cinema_name" type="text"  autocomplete="off"  /> 
								<input class="form-control range_cinema_id" name="couponList[0].rangeCinemaId" type="text" style="display: none"/> 
								<ul class="tip">

								</ul>
							</div>
						</div>
						<div class="form-group type_dis_cinema" id="type_dis_formal" style="display : none" >
							<label class="col-sm-2 control-label">确定影院名</label>
							<div class="col-sm-5">
								<textarea class="form-control range_cinema_name_formal" rows="4" cols="12" name="couponList[0].rangeCinemaName"  id="getcinemaname_formal" readonly></textarea>
							</div>
							<span class="help-inline col-sm-4" id="min_price" > <i class="fa fa-info-circle"></i> 提交影院以此栏内容为准</span>
						</div> -->
						
						<!-- 限制城市 -->
						<!-- <div class="form-group">
							<label class="col-sm-2 control-label">是否限制城市使用</label>
							<div class="col-sm-5">
								<input type="checkbox"  class="is_range_city" value="确定" onclick="lookcity(this);" />
							</div>
						</div>
						
						<div class="form-group type_dis_city" style="display : none" >
							<label class="col-sm-2 control-label">请填写待搜索城市名</label>
							<div class="col-sm-5">
								<input class="form-control range_city_name" type="text"  autocomplete="off" /> 
								<input class="form-control range_city_code" name="couponList[0].rangeCityCode" type="text" style="display: none"/> 
								<ul class="tip">

								</ul>
							</div>
						</div>
						<div class="form-group type_dis_city" id="type_dis_formal" style="display : none" >
							<label class="col-sm-2 control-label">确定城市名</label>
							<div class="col-sm-5">
								<textarea class="form-control range_city_name_formal" rows="4" cols="12" name="couponList[0].rangeCityName"  id="getcityname_formal" readonly></textarea>
							</div>
							<span class="help-inline col-sm-4" id="min_price" > <i class="fa fa-info-circle"></i> 提交城市以此栏内容为准</span>
						</div> -->
					</div>
				</form>
				<div class="form-group">
					<div class="col-sm-2 col-sm-offset-3">
						<button type="button" class="btn btn-green" onclick="nextItem()">下一个</button>
						<button type="button" class="btn btn-red" onclick="platform_exchangeCard.submitValiFunc(this.form,false);">提交	<i class="fa fa-arrow-circle-right"></i></button>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
	var token = MXCookie.get("token",token);  // 登陆token;
	var username = GetQueryString("username"); // 用户名	
	datePicker($(".begin_date"));  // 开始时间
	datePicker($(".end_date"));    // 结束时间	
	$("#username").val(username);
	$("#token").val(token);

	
	jQuery(document).ready(function() {
        // common_form.init();
    });
    
    function radioClick(value,obj){
        if(value=="1"){
            var awardPointDiv=$(obj).parents('.form-group').siblings('.awardPointDiv').hide();
            var awardPointInput=awardPointDiv.find('input').val(0);

            var awardNumDiv=$(obj).parents('.form-group').siblings('.awardNumDiv').hide();
            var awardPointInput=awardNumDiv.find('input').val(0);
        }else{
            var awardPointDiv=$(obj).parents('.form-group').siblings('.awardPointDiv').show();
            var awardPointInput=awardPointDiv.find('input').val(0);

            var awardNumDiv=$(obj).parents('.form-group').siblings('.awardNumDiv').show();
            var awardPointInput=awardNumDiv.find('input').val(0);
        }
    }
    
    function clearNoNum(obj){ 
        obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符  
        obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的  
        obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$","."); 
        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数  
        if(obj.value.indexOf(".")< 0 && obj.value !=""){//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额 
            obj.value= parseFloat(obj.value); 
        } 
    } 
	function change(o){
		var prefix = o.value;
		if(prefix=='REDBAG_'){
			$(o).parents(".wheelAwardItem").find(".maximum_price_help").html("<i class='fa fa-info-circle'></i> 红包金额，也是红包能够减免的最大金额");
			$(o).parents(".wheelAwardItem").find(".minimum_price_help").html("<i class='fa fa-info-circle'></i> 支付金额要大于此输入数值才能够使用");
			$(o).parents(".wheelAwardItem").find(".minimum_price_div").show();
			$(o).parents(".wheelAwardItem").find(".minimum_price_div").find(".minimum_price").val("");
		}else if(prefix=='EXCHANGE_'){
			$(o).parents(".wheelAwardItem").find(".maximum_price_help").html("<i class='fa fa-info-circle'></i> 影票价格小于等于此输入数值才可使用");
			$(o).parents(".wheelAwardItem").find(".minimum_price_div").hide();
			$(o).parents(".wheelAwardItem").find(".minimum_price_div").find(".minimum_price").val("");
		}
	}
	
	function lookfilm(obj){
		var checked = $(obj).is(":checked");
		if(checked){
			$(obj).parents(".wheelAwardItem").find(".type_dis_film").show();
			$(obj).parents(".wheelAwardItem").find(".type_dis_film").find(".form-control").val("");
		}else{
			$(obj).parents(".wheelAwardItem").find(".type_dis_film").hide();
			$(obj).parents(".wheelAwardItem").find(".type_dis_film").find(".form-control").val("");
		}
	}
	function lookcinema(obj){
		var checked = $(obj).is(":checked");
		if(checked){
			$(obj).parents(".wheelAwardItem").find(".type_dis_cinema").show();
			$(obj).parents(".wheelAwardItem").find(".type_dis_cinema").find(".form-control").val("");
		}else{
			$(obj).parents(".wheelAwardItem").find(".type_dis_cinema").hide();
			$(obj).parents(".wheelAwardItem").find(".type_dis_cinema").find(".form-control").val("");
		}
	}
	function lookcity(obj){
		var checked = $(obj).is(":checked");
		if(checked){
			$(obj).parents(".wheelAwardItem").find(".type_dis_city").show();
			$(obj).parents(".wheelAwardItem").find(".type_dis_city").find(".form-control").val("");
		}else{
			$(obj).parents(".wheelAwardItem").find(".type_dis_city").hide();
			$(obj).parents(".wheelAwardItem").find(".type_dis_city").find(".form-control").val("");
		}
	}

	
	$("#editForm").on('input','.range_film_name',function(){
		var index = $(".range_film_name").index(this);
		var film_name = $(this).val();
		console.log(film_name);
		var obj = $(this).parent("div").children("ul");	
		$(obj).html("");
		$.ajax({
			url: localStorage.grobalUrl + "/discount/NameToId",
			type: "post",
			data: {
				filmName: film_name,
				token: token,
				username: username			
			},
			success:function(data){
				if(data.errCode == "00000"){
					var dataVal = data.errMsg;
					var html = "";
					for(var i = 0; i < dataVal.length; i ++){
						console.log()
						var filmData = dataVal[i];

						html = html + '<span style="cursor:pointer"><li style="list-style-type:none;" data-Id="';
						html = html + filmData.film_id;
						html = html + '" data-Name="';
						html = html + filmData.show_name;
						html = html + '" onclick="input_film_name(this);" '
						html = html + '" class="filmNameTip">';
						html = html + filmData.show_name;
						html = html + '</li></span>';						
					}
					$(obj).html(html);
				}else if(data.errCode == "00005"){
					tips("请重新登陆");
					setTimeout(function(){
						window.location.href = "login_login.html";
					},500);					
				}else{}	
			},
			error:function(res){
				alert("失败");
			}
		});
	});
	// 
	// $("#editForm").on('input','.range_cinema_name',function(){
	// 	var cinema_name = $(this).val();
	// 	var obj = $(this).parent("div").children("ul");	
	// 	$(obj).html("");
	// 	$.ajax({
	// 		type: "post",
	// 		dataType: 'json',
	// 		url: '${cxt!}/jf/platform/movieSupporter/getCinemaByName',
	// 		data: {"name": cinema_name},
	// 		success:function(res){
	// 			if(res.length!=0){
	// 				console.log(res);
	// 				var html = "";
	// 				$.each(res,function(index,cinemaInfo){
	// 					html = html + '<span style="cursor:pointer"><li style="list-style-type:none;" data-Id="';
	// 					html = html + cinemaInfo.cinemaId;
	// 					html = html + '" data-Name="';
	// 					html = html + cinemaInfo.cinemaName;
	// 					html = html + '" onclick="input_cinema_name(this);" '
	// 					html = html + '" class="cinemaNameTip">';
	// 					html = html + cinemaInfo.cinemaName;
	// 					html = html + '</li></span>';
	// 				})
	// 				$(obj).html(html);
	// 			}
	// 		},
	// 		error:function(res){
	// 			alert("失败");
	// 		}
	// 	});
	// });
	// $("#editForm").on('input','.range_city_name',function(){
	// 	var city_name = $(this).val();
	// 	var obj = $(this).parent("div").children("ul");	
	// 	$(obj).html("");
	// 	$.ajax({
	// 		type: "post",
	// 		dataType: 'json',
	// 		url: '${cxt!}/jf/platform/movieSupporter/getCityByName',
	// 		data: {"name": city_name},
	// 		success:function(res){
	// 			if(res.length!=0){
	// 				console.log(res);
	// 				var html = "";
	// 				$.each(res,function(index,cityInfo){
	// 					html = html + '<span style="cursor:pointer"><li style="list-style-type:none;" data-Id="';
	// 					html = html + cityInfo.cityCode;
	// 					html = html + '" data-Name="';
	// 					html = html + cityInfo.cityName;
	// 					html = html + '" onclick="input_city_name(this);" '
	// 					html = html + '" class="cityNameTip">';
	// 					html = html + cityInfo.cityName;
	// 					html = html + '</li></span>';
	// 				})
	// 				$(obj).html(html);
	// 			}
	// 		},
	// 		error:function(res){
	// 			alert("失败");
	// 		}
	// 	});
	// });
	
	function input_film_name(liObj){
		var filmId = $(liObj).attr("data-Id");
		var filmId1 = $(liObj).parent("span").parent("ul").parent("div").children(".range_film_id").val();
		var filmName = $(liObj).attr("data-Name");
		var filmName1 = $(liObj).parent("span").parent("ul").parent("div").parent(".type_dis_film").next(".type_dis_film").find(".range_film_name_formal").val();
		filmName1 = filmName1 + "," +filmName;
		$(liObj).parent("span").parent("ul").parent("div").parent(".type_dis_film").next(".type_dis_film").find(".range_film_name_formal").val(filmName1);
		$(liObj).parent("span").parent("ul").parent("div").children(".range_film_name").val("");
		filmId1 = filmId1 + "," +filmId;
		$(liObj).parent("span").parent("ul").parent("div").children(".range_film_id").val(filmId1);
		$(liObj).parent("span").parent("ul").html("");
	}
	function input_cinema_name(liObj){
		var filmId = $(liObj).attr("data-Id");
		var filmId1 = $(liObj).parent("span").parent("ul").parent("div").children(".range_cinema_id").val();
		var filmName = $(liObj).attr("data-Name");
		var filmName1 = $(liObj).parent("span").parent("ul").parent("div").parent(".type_dis_cinema").next(".type_dis_cinema").find(".range_cinema_name_formal").val();
		filmName1 = filmName1 + "," +filmName;
		$(liObj).parent("span").parent("ul").parent("div").parent(".type_dis_cinema").next(".type_dis_cinema").find(".range_cinema_name_formal").val(filmName1);
		$(liObj).parent("span").parent("ul").parent("div").children(".range_cinema_name").val("");
		filmId1 = filmId1 + "," +filmId;
		$(liObj).parent("span").parent("ul").parent("div").children(".range_cinema_id").val(filmId1);
		$(liObj).parent("span").parent("ul").html("");
	}
	function input_city_name(liObj){
		var filmId = $(liObj).attr("data-Id");
		var filmId1 = $(liObj).parent("span").parent("ul").parent("div").children(".range_city_code").val();
		var filmName = $(liObj).attr("data-Name");
		var filmName1 = $(liObj).parent("span").parent("ul").parent("div").parent(".type_dis_city").next(".type_dis_city").find(".range_city_name_formal").val();
		filmName1 = filmName1 + "," +filmName;
		$(liObj).parent("span").parent("ul").parent("div").parent(".type_dis_city").next(".type_dis_city").find(".range_city_name_formal").val(filmName1);
		$(liObj).parent("span").parent("ul").parent("div").children(".range_city_name").val("");
		filmId1 = filmId1 + "," +filmId;
		$(liObj).parent("span").parent("ul").parent("div").children(".range_city_code").val(filmId1);
		$(liObj).parent("span").parent("ul").html("");
	}
	$("#number").change(function(){
		var obj = $("#number");
		if(obj.val()>1000){
			alert("生成卡的数量最多为1000张");
			obj.val("1000");
		}
	})
	
	function limit_coupon_num(obj){
		var val = $(obj).val();
		if(val > 10){
			alert("优惠券数量最多为10张");
			$(obj).parent(".col-sm-5").find("input").val("10");
		}
	}





	function nextItem(){
	    var count = $(".wheelAwardItem").length;
	    index = count;
	    var wheelAwardItemDiv = $("#wheelAwardItem").clone();

	    wheelAwardItemDiv.find(".name").attr("name","couponList["+index+"].name");
	    wheelAwardItemDiv.find(".name").val("");
	    
	    wheelAwardItemDiv.find(".prefix").attr("name","couponList["+index+"].prefix");
	    
	    wheelAwardItemDiv.find(".point").attr("name","couponList["+index+"].point");
	    wheelAwardItemDiv.find(".point").val("");
	    
	    wheelAwardItemDiv.find(".introduction").attr("name","couponList["+index+"].introduction");
	    wheelAwardItemDiv.find(".introduction").val("");
	    
	    wheelAwardItemDiv.find(".begin_date").attr("name","couponList["+index+"].begin_date");
	    wheelAwardItemDiv.find(".begin_date").val("");
	    
	    wheelAwardItemDiv.find(".end_date").attr("name","couponList["+index+"].end_date");
	    wheelAwardItemDiv.find(".end_date").val("");
	   
	    
	    wheelAwardItemDiv.find(".maximum_price").attr("name","couponList["+index+"].maximum_price");
	    wheelAwardItemDiv.find(".maximum_price").val("");

	    wheelAwardItemDiv.find(".minimum_price").attr("name","couponList["+index+"].minimum_price");
	    wheelAwardItemDiv.find(".minimum_price").val("");
	   
	  
	    wheelAwardItemDiv.find(".is_range_film").attr("checked", false);
	    wheelAwardItemDiv.find(".range_film_id").attr("name","couponList["+index+"].rangeFilmId");
	    wheelAwardItemDiv.find(".range_film_id").val("");
	    wheelAwardItemDiv.find(".range_film_name_formal").attr("name","couponList["+index+"].rangeFilmName");
	    wheelAwardItemDiv.find(".range_film_name_formal").val("");
	    
	    wheelAwardItemDiv.find(".is_range_cinema").attr("checked", false);
	    wheelAwardItemDiv.find(".range_cinema_id").attr("name","couponList["+index+"].rangeCinemaId");
	    wheelAwardItemDiv.find(".range_cinema_id").val("");
	    wheelAwardItemDiv.find(".range_cinema_name_formal").attr("name","couponList["+index+"].rangeCinemaName");
	    wheelAwardItemDiv.find(".range_cinema_name_formal").val("");
	    
	    wheelAwardItemDiv.find(".is_range_city").attr("checked", false);
	    wheelAwardItemDiv.find(".range_city_code").attr("name","couponList["+index+"].rangeCityCode");
	    wheelAwardItemDiv.find(".range_city_code").val("");
	    wheelAwardItemDiv.find(".range_city_name_formal").attr("name","couponList["+index+"].rangeCityName");
	    wheelAwardItemDiv.find(".range_city_name_formal").val("");
	    
	    wheelAwardItemDiv.find(".type_dis_film").hide();
	    wheelAwardItemDiv.find(".type_dis_cinema").hide();
	    wheelAwardItemDiv.find(".type_dis_city").hide();
	    
	    wheelAwardItemDiv.find(".maximum_price_help").html("<i class='fa fa-info-circle'></i> 红包减免最大金额");
	    wheelAwardItemDiv.find(".minimum_price_help").html("<i class='fa fa-info-circle'></i> 支付金额要大于此输入数值才能够使用");
	    wheelAwardItemDiv.find(".minimum_price_div").show();
	    $("#editForm").append(wheelAwardItemDiv);
		datePicker($(".begin_date"));  // 开始时间
		datePicker($(".end_date"));    // 结束时间	    
	}
	function removeItem(obj){
	    var count = $(".wheelAwardItem").length;
	    if(count>0){
	        $(obj).parent("div").parent("div").parent("div").remove();
	    }
	    var index=0;
	    $(".wheelAwardItem").each(function(){
	    	
	        $(this).find(".name").attr("name","couponList["+index+"].name");
	        $(this).find(".prefix").attr("name","couponList["+index+"].prefix");
	        $(this).find(".point").attr("name","couponList["+index+"].point");
	        $(this).find(".introduction").attr("name","couponList["+index+"].introduction");
	        $(this).find(".begin_date").attr("name","couponList["+index+"].begin_date");
	        $(this).find(".end_date").attr("name","couponList["+index+"].end_date");
	        $(this).find(".maximum_price").attr("name","couponList["+index+"].maximum_price");
	        $(this).find(".minimum_price").attr("name","couponList["+index+"].minimum_price");
	        
	        $(this).find(".range_film_id").attr("name","couponList["+index+"].rangeFilmId");
	        $(this).find(".range_film_name_formal").attr("name","couponList["+index+"].rangeFilmName");
	       
	        $(this).find(".range_cinema_id").attr("name","couponList["+index+"].rangeCinemaId");
	        $(this).find(".range_cinema_name_formal").attr("name","couponList["+index+"].rangeCinemaName");
	        
	        $(this).find(".range_city_code").attr("name","couponList["+index+"].rangeCityCode");
	        $(this).find(".range_city_name_formal").attr("name","couponList["+index+"].rangeCityName");

	        index=index+1;
	    })
	}


	var platform_exchangeCard = function() {
		
		var dataVali = function (form, isAdd){
			if(isAdd){
				
			}else{
				var name = $('#name').val();
				if (name == '')
				{
					alert("优惠券名称不能为空！");
					return false;
				}
				
				var point = $('#point').val();
				if (point == '')
				{
					alert("优惠券数量不能为空！");
					return false;
				}
				
				var introduction = $('#introduction').val();
				if (introduction == '')
				{
					alert("介绍不能为空！");
					return false;
				}
				
				var begin_date = $('#begin_date').val();
				if (begin_date == '')
				{
					alert("开始日期不能为空！");
					return false;
				}
				
				var end_date = $('#end_date').val();
				if (end_date == '')
				{
					alert("结束日期不能为空！");
					return false;
				}
				
				var maximum_price = $('#maximum_price').val();
				if (maximum_price == '')
				{
					alert("最大商品价格不能为空！");
					return false;
				}
				
				var maximum_quantity = $('#maximum_quantity').val();
				if (maximum_quantity == '')
				{
					alert("最大商品数量不能为空！");
					return false;
				}
				
				/*var end_datetime = $('#minimum_price').val();
				if (end_datetime == '')
				{
					alert("最小商品价格不能为空！");
					return false;
				}
				
				var end_datetime = $('#minimum_quantity').val();
				if (end_datetime == '')
				{
					alert("最小商品数量不能为空！");
					return false;
				}*/
				
				var point = $('#point').val();
				if (point == '')
				{
					alert("优惠券数量不能为空！");
					return false;
				}
				
				var number = $('#number').val();
				if (number == '')
				{
					alert("生成卡的数量不能为空！");
					return false;
				}else if(number>1000){
					alert("生成卡的数量不能超过100张！");
					return false;
				}
			}
			
			
			common_ajax.ajaxFormMainPanel("editForm");
		}

		return {
			submitValiFunc: dataVali
		};
		
	}();


	


</script>
